

const init=document.querySelector('.init');
const logout= document.querySelector('.logout a');
const oneMenulist=document.querySelectorAll('.nav>li>a');
const twoMenulist=document.querySelectorAll('.nav ul a');

init.addEventListener('click',function () {
    axios.get('init/data').then(result=>console.log(result))
})



logout.addEventListener('click',function () {
    if(confirm('您确定要退出吗？')){
        localStorage.removeItem('token82')
        location.href='./login.html'
    }
})
oneMenulist[0].querySelector(".toggle").classList.add('open')
oneMenulist.forEach((one,)=>{
    
    one.addEventListener('click',function () { 
        if( one.querySelector('.toggle.open')){
            one.querySelector('.toggle.open').classList.remove('open')
            one.querySelector('.toggle').classList.add('close')
        }else if(one.querySelector('.toggle.close')){
            one.querySelector('.toggle.close').classList.remove('close')
            one.querySelector('.toggle').classList.add('open')
        }
            
        
        one.nextElementSibling.classList.toggle('show')
    })
    
})

twoMenulist.forEach((two)=>{
    two.addEventListener('click',function () {
        document.querySelector('.nav ul a.active').classList.remove('active')
        two.classList.add('active')
    })
})

